package hutool;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.CalendarUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.Month;

import java.util.Arrays;

/**
 * @Author: DRevelation
 * @Date: 2021/4/23 13:47
 */
public class ConvertDemo {
    public static void main(String[] args) {
        String ids = "1,2,3,4,5";
        Integer[] idArr = Convert.toIntArray(ids);
        System.out.println("idArr = " + Arrays.toString(idArr));

        // 全角转半角
        System.out.println(Convert.toSBC(ids));

        // Unicode
        String a = "我是一个小小的可爱的字符串";
        String u = Convert.strToUnicode(a);
        System.out.println("u = " + u);

        // 中文（只精确到分）
        String money = Convert.digitToChinese(123.3456);
        System.out.println("money = " + money);

        System.out.println("DateUtil.date() = " + DateUtil.date());
        System.out.println("DateUtil.date(CalendarUtil.calendar()) = " + DateUtil.date(CalendarUtil.calendar()));
        System.out.println("DateUtil.date(System.currentTimeMillis()) = " + DateUtil.date(System.currentTimeMillis()));
        System.out.println("DateUtil.now() = " + DateUtil.now());
        System.out.println("DateUtil.today() = " + DateUtil.today());

        // "摩羯座"
        String zodiac = DateUtil.getZodiac(Month.APRIL.getValue(), 3);
        System.out.println("zodiac = " + zodiac);
        // "狗"
        String chineseZodiac = DateUtil.getChineseZodiac(1993);
        System.out.println("chineseZodiac = " + chineseZodiac);
    }
}
